<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
      layout:decorator="admin/public/layout">

<head>
    <title>注册设置</title>
    <link th:href="@{/static/js/summernote/summernote.css}" rel="stylesheet">
</head>
<div  layout:fragment="content">
    <section class="content-header">
        <h1>
            注册设置
            <small>全站注册策略设置</small>
        </h1>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box box-primary">
                    <form role="form" name="addForm" id="register_form" method="POST" th:action="@{/admin/setting/register}">
                        <input type="hidden" name="id" th:value="${GlobalSetting.register.id}"/>
                        <div class="box-body">
                            <div class="form-group">
                                <label>允许新用户注册</label>
                                <span class="text-muted">(若不需要新用户注册，可以到用户管理里面手动添加用户	)</span>
                                <div class="radio">
                                    <label><input type="radio" name="open" value="true" th:checked="${settingRegister.open}" > 允许 </label>
                                    <label class="ml-20"><input type="radio" name="open" value="false"  th:checked="!${settingRegister.open}" > 拒绝 </label>
                                </div>
                            </div>



                            <div class="form-group">
                                <label>24小时内同一IP的最大注册用户数目</label>
                                <span class="text-muted">(设置为0代表不做任何限制)</span>
                                <input type="text" class="form-control" name="limitNum" placeholder="0为不限制" th:value="${settingRegister.limitNum}"  />
                            </div>

                            <div class="form-group">
                                <label>注册欢迎语</label>
                                <input type="text" class="form-control" name="title" placeholder="欢迎加入Tipask站长社区" th:value="${settingRegister.title}" />
                            </div>

                            <div class="form-group">
                                <label>用户注册协议</label>
                                <div id="register_editor"></div>
                            </div>

                        </div>
                        <div class="box-footer">
                            <input type="hidden" id="register_editor_content"  name="license" th:value="${settingRegister.license}"  />
                            <button type="submit" class="btn btn-primary editor-submit" >保存</button>
                            <button type="reset" class="btn btn-success">重置</button>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </section>
    <script th:src="@{/static/js/summernote/summernote.min.js}"></script>
    <script th:src="@{/static/js/summernote/lang/summernote-zh-CN.min.js}"></script>
    <script type="text/javascript" th:inline="javascript">
        $(function(){
            $('#register_editor').summernote({
                lang: 'zh-CN',
                height: 300,
                placeholder:'完善用户注册协议',
                toolbar: [ ['common', ['style','bold','color','ol', 'paragraph','table','link','picture','clear','fullscreen']] ],
                callbacks: {
                    onChange:function (contents, $editable) {
                        var code = $(this).summernote("code");
                        $("#register_editor_content").val(code);
                    },
                    onImageUpload: function(files) {
                        upload_editor_image(files[0],'register_editor');
                    }
                }
            });
            $('#register_editor').summernote('code',[[${settingRegister.license}]]);

        });
    </script>
</div>